<!--
 * @Description: 
 * @Version: 1.0
 * @Autor: younghxp
 * @Date: 2021-12-13 15:29:48
 * @LastEditors: younghxp
 * @LastEditTime: 2021-12-15 17:57:04
-->
<template>
  <div>
    <topTitle
      :titleText="titleText"
      :back="true"
      @gobackTriser="goBack"
    ></topTitle>
    <div class="infoBox infoBox1">
      <p class="secondaryTitle secondaryTitleTheme">项目信息</p>
      <el-row class="detailInfoItemSty">
        <el-col :span="12" class="labelWidthSty">
          <span class="gridContent color333 fontSizeF fontWeight"
            >项目名称：</span
          >
          <span class="gridContent contentSty color666 fontSizeF">{{
            taskDetail.projectName || '--'
          }}</span>
        </el-col>
        <el-col :span="12" class="labelWidthSty">
          <span class="gridContent color333 fontSizeF fontWeight"
            >单位地址：</span
          >
          <span class="gridContent contentSty color666 fontSizeF">{{
            taskDetail.address || '--'
          }}</span>
        </el-col>
      </el-row>
      <el-row class="detailInfoItemSty">
        <el-col :span="12" class="labelWidthSty">
          <span class="gridContent color333 fontSizeF fontWeight"
            >施工方：</span
          >
          <span class="gridContent contentSty color666 fontSizeF">{{
            taskDetail.pbName || '--'
          }}</span>
        </el-col>
        <el-col :span="12" class="labelWidthSty">
          <span class="gridContent color333 fontSizeF fontWeight"
            >建设方：</span
          >
          <span class="gridContent contentSty color666 fontSizeF">{{
            taskDetail.pcName || '--'
          }}</span>
        </el-col>
      </el-row>
      <el-row class="detailInfoItemSty">
        <el-col :span="12" class="labelWidthSty">
          <span class="gridContent color333 fontSizeF fontWeight"
            >行业类型：</span
          >
          <span class="gridContent contentSty color666 fontSizeF">{{
            taskDetail.industryName || '--'
          }}</span>
        </el-col>
        <el-col :span="12" class="labelWidthSty">
          <span class="gridContent color333 fontSizeF fontWeight"
            >投资类型：</span
          >
          <span class="gridContent contentSty color666 fontSizeF">{{
            taskDetail.investmentDesc || '--'
          }}</span>
        </el-col>
      </el-row>
      <el-row class="detailInfoItemSty">
        <el-col :span="12" class="labelWidthSty">
          <span class="gridContent color333 fontSizeF fontWeight"
            >项目负责人：</span
          >
          <span class="gridContent contentSty color666 fontSizeF">{{
            taskDetail.managerName || '--'
          }}</span>
        </el-col>
        <el-col :span="12" class="labelWidthSty">
          <span class="gridContent color333 fontSizeF fontWeight"
            >联系电话：</span
          >
          <span class="gridContent contentSty color666 fontSizeF">{{
            taskDetail.managerTel || '--'
          }}</span>
        </el-col>
      </el-row>
    </div>
    <div class="infoBox">
      <p class="secondaryTitle secondaryTitleTheme">网格巡查情况</p>
      <el-row class="detailInfoItemSty">
        <el-col :span="12" class="labelWidthSty">
          <span class="gridContent color333 fontSizeF fontWeight"
            >处理时间：</span
          >
          <span class="gridContent contentSty color666 fontSizeF">{{
            taskDetail.actualTime || '--'
          }}</span>
        </el-col>
        <el-col :span="12" class="labelWidthSty">
          <span class="gridContent color333 fontSizeF fontWeight"
            >处理人：</span
          >
          <span class="gridContent contentSty color666 fontSizeF">{{
            taskDetail.inspector || '--'
          }}</span>
        </el-col>
      </el-row>
      <el-row class="detailInfoItemSty">
        <el-col :span="24" class="labelWidthSty">
          <div class="gridContent color333 fontSizeF fontWeight">巡查内容</div>
        </el-col>
        <el-col :span="24">
          <div class="table">
            <el-table
              :data="tableList"
              v-loading="loading"
              :header-cell-style="{ background: '#eef1f6', color: '#606266' }"
              highlight-current-row
              stripe
              style="border: 1px solid #dfe6ec"
            >
              <el-table-column
                prop="name"
                label="巡查事项"
                :formatter="formatTd"
              ></el-table-column>
              <el-table-column
                prop="content"
                label="处理详情"
                :formatter="formatTd"
              ></el-table-column>
              <el-table-column label="凭证附件" align="center" width="120">
                <template slot-scope="scope">
                  <el-link
                    type="primary"
                    @click="showAttach(scope.row.fileExpandVOS)"
                    >附件</el-link
                  >
                </template>
              </el-table-column>
              <!-- 表格数据为空时，页面显示 -->
              <div slot="empty" v-show="tableList.length < 1">
                <emptyTable emptyText="暂无相关数据"></emptyTable>
              </div>
            </el-table>
          </div>
        </el-col>
      </el-row>
    </div>
    <contractEnclosureDialog
      v-if="isShowAttach"
      dialogTitle="凭证附件"
      :tableData="upLoadFile"
      @closeDialog="hiddenAttach"
      :isOtherOrigin="true"
    ></contractEnclosureDialog>
  </div>
</template>

<script>
export default {
  name: 'CustomPatrolDetail',
  data() {
    return {
      titleText: '查看巡查详情',
      taskDetail: {}, //详情
      tableList: [], //巡查内容表格
      upLoadFile: [],
      isShowAttach: false,
    }
  },
  created() {
    this.getTaskDetail()
  },
  methods: {
    /**
     * @description: 详情
     * @param {*}
     * @return {*}
     */
    getTaskDetail() {
      return this.axios({
        method: 'post',
        url: 'api-gov/pcipqc/task/detail',
        data: {
          id: this.$route.query.id,
        },
      })
        .then((response) => {
          if (!response.data.hasError) {
            const { result } = response.data
            this.taskDetail = result
            this.tableList = result.pcIpqcItemVOS || []
          } else {
            this.$message.error(response.data.errorMsg)
          }
        })
        .catch((error) => {
          if (error.response) {
            this.$message.error(error.response.data)
          }
        })
    },
    /**
     * @description: 展示附件弹窗
     * @param {*}
     * @return {*}
     */
    showAttach(upLoadFile) {
      this.upLoadFile = upLoadFile
      this.isShowAttach = true
    },
    hiddenAttach() {
      this.isShowAttach = false
    },
    goBack() {
      this.$router.push({
        path: '/home/gridPatrol/patrolTask',
        name: 'patrolTask',
        query: {
          activeName: 'second',
        },
      })
      this.$store.commit('GOBACK_NAME', {
        oldUrl: '/home/gridPatrol/patrolTask',
        newUrl: this.$router.currentRoute.fullPath,
      })
    },
  },
}
</script>

<style lang="less" scoped>
.infoBox {
  padding: 20px 24px;
  position: relative;
  .el-row {
    padding-left: 14px;
  }
  .info {
    line-height: 36px;
    font-size: 14px;
    color: #666;
  }
  .desc {
    display: inline-block;
    color: #333;
  }
  .tableTitle {
    line-height: 36px;
    vertical-align: top;
    font-size: 14px;
  }
  .table {
    display: inline-block;
    margin-top: 10px;
  }
}
.infoBox1 {
  &::after {
    position: absolute;
    width: 100%;
    height: 1px;
    background-color: #f5f6f7;
    content: '';
    bottom: 0;
    left: 0;
    transform: translateY(0.5);
  }
}
</style>
